using UnityEngine;
using UnityEngine.Networking;

public class Projectile : DamageBase
{
	public float Duration = 3f;

	public GameObject Spawn;

	private float timeTemp;

	private bool isQuitting;

	private void PositionUpdate(Vector3 position, Quaternion rotation, int id)
	{
		base.NetworkOwnerID = id;
		base.transform.position = Vector3.Lerp(base.transform.position, position, 1f);
		base.transform.rotation = Quaternion.Lerp(base.transform.rotation, rotation, 1f);
	}

	private void OnApplicationQuit()
	{
		isQuitting = true;
	}

	private void OnDestroy()
	{
		if (!isQuitting && (bool)Spawn)
		{
			GameObject gameObject = Object.Instantiate(Spawn, base.transform.position, base.transform.rotation);
			DamageBase component = gameObject.GetComponent<DamageBase>();
			if ((bool)component)
			{
				component.NetworkOwnerID = OwnerID;
				component.NetworkOwnerTeam = OwnerTeam;
			}
		}
	}

	private void Start()
	{
		timeTemp = Time.time;
	}

	private void Update()
	{
		if (Time.time >= timeTemp + Duration)
		{
			OnDead();
		}
	}

	private void OnDead()
	{
		NetworkServer.Destroy(base.gameObject);
	}

	private void UNetVersion()
	{
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		bool flag = base.OnSerialize(writer, forceAll);
		bool flag2 = default(bool);
		return flag2 | flag;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
		base.OnDeserialize(reader, initialState);
	}
}
